﻿using System;

namespace SocialKit.LightRest.OAuth
{
    /// <summary>
    /// Utilities for OAuth.
    /// </summary>
    public static class OAuthUtil
    {
        /// <summary>
        /// Generates the nonce for OAuth.
        /// </summary>
        /// <returns></returns>
        public static string GenerateNonce()
        {
            return Guid.NewGuid().ToString().Replace("-", String.Empty);
        }

        /// <summary>
        /// Returns the current timestamp for OAuth.
        /// </summary>
        /// <returns></returns>
        public static string GenerateTimestamp()
        {
            var span = (DateTime.UtcNow - new DateTime(1970, 1, 1));

            return Convert.ToInt64(span.TotalSeconds).ToString();
        }
    }
}